<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="Template.xhtml">
        <ui:define name="top">
            #{bundle.create}#{bundle.VRP}

        </ui:define>
        <ui:define name="content">

            <f:event listener="#{problemCreateMB.precreateProblem()}"
                     type="preRenderView"></f:event>
            <!--<p:outputPanel deferred="true" >-->
            <!--<shiro:hasPermission name="user:V">--> 
            <h:form id="form">


                <p:panel>
                    <div class="left"><h3>#{bundle.basic}#{bundle.info}</h3></div> 
                    <p:panelGrid styleClass="noborder left" columns="2"   >
                        <h:outputText value="#{bundle.depot} " />
                        <p:selectOneMenu id="depot" value="#{problemCreateMB.currentProblem.iddepot}"  converter="#{depotConvert}" required="true"   requiredMessage="#{bundle.pleaseInput}#{bundle.depot}">
                            <f:selectItems  var="depot" value="#{problemCreateMB.depotlist}"  itemValue="#{depot}" itemLabel="#{depot.name}" />
                            <p:ajax event="change" listener="#{problemCreateMB.ondepotchange()}" update="@form,selectcustomerdemand,selectattendance"/>
                            <!--update="vehicle,driver"-->
                        </p:selectOneMenu>
                        <h:outputText value="配送作业#{bundle.date}" />
                        <p:calendar id="fordate"  value="#{problemCreateMB.currentProblem.fordate}"  required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.date}" >
                            <p:ajax event="dateSelect" listener="#{problemCreateMB.ontimechange()}" update="@form,selectcustomerdemand,selectattendance"/>
                        </p:calendar>
                        <h:outputText value="#{bundle.depotready}" />
                        <p:calendar id="readyTime"  value="#{problemCreateMB.currentProblem.readyTime}"  required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.depotready}" pattern="HH:mm" timeOnly="true">
                            <p:ajax event="dateSelect" listener="#{problemCreateMB.ontimechange()}" update="@form,selectcustomerdemand,selectattendance"/>
                        </p:calendar>
                        <h:outputText value="#{bundle.depotdue}" />
                        <p:calendar id="dueDate"  value="#{problemCreateMB.currentProblem.dueDate}"  required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.depotdue}" pattern="HH:mm" timeOnly="true">
                            <p:ajax event="dateSelect" listener="#{problemCreateMB.ontimechange()}" update="@form,selectcustomerdemand,selectattendance"/>
                        </p:calendar>




                    </p:panelGrid>
                    <p:separator />
                    <p:panelGrid styleClass="noborder left"  style="width:50% " columns="2"   >
                        <div class="left"><h3>#{bundle.duty}#{bundle.vehicle}</h3></div> 
                        <p:commandButton update=":growl" immediate="true" oncomplete="PF('selectattendance').show();" value="#{bundle.add}#{bundle.duty}#{bundle.vehicle}"/>
                    </p:panelGrid>
                    <ui:include src="create/attendanceform.xhtml" />
                    <p:separator />
                    <p:panelGrid styleClass="noborder left"  style="width:50% " columns="2"   >
                        <div class="left"><h3>#{bundle.order}</h3></div> 
                        <p:commandButton update=":growl" immediate="true" oncomplete="PF('selectcustomerdemand').show();" value="#{bundle.add}#{bundle.order}"/>
                    </p:panelGrid>
                    <ui:include src="create/customerdemandform.xhtml" />
                     <p:commandButton update=":growl" action="#{problemCreateMB.create()}" value="#{bundle.submit}"/>

                     <p:commandButton update=":growl" action="#{problemCreateMB.createAndcalculate()}" value="#{bundle.submit}#{bundle.calculate}"/>

                </p:panel>

            </h:form>
            <p:dialog header="#{bundle.select}#{bundle.duty}#{bundle.vehicle}"  id="selectattendance" widgetVar="selectattendance" resizable="false" modal="true" width="100%">
                <ui:include src="create/attendancedialog.xhtml" />
            </p:dialog>
            <p:dialog header="#{bundle.select}#{bundle.order}" id="selectcustomerdemand" widgetVar="selectcustomerdemand" resizable="false" modal="true" width="100%">
                <ui:include src="create/customerdemanddialog.xhtml" />
            </p:dialog>


            <!--</p:outputPanel>-->
            <!--</shiro:hasPermission>-->
        </ui:define>
    </ui:composition>
</html>

